Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Choose Folder

The Choose Folder command displays a dialog box like the one in Figure 2-3 to allow the user to choose a directory (that is, a folder, a volume, or the desktop).

Figure 2-3 A Choose Folder dialog box

The Choose Folder command is one of two commands provided by the Choose File scripting addition.

SYNTAX
choose folder [ with prompt promptString ]
PARAMETERS
promptString
The prompt that appears in the dialog box. The prompt can be up to 255 characters long, but the standard dialog box has room for only about 80 characters. If you omit the with prompt parameter, the string "Choose a folder:" is displayed.
Class: String
Default Value: "Choose a folder:"
RESULT
A reference of the form file "Disk:Folder1:Folder2:...:Foldername" for the directory specified by the user, if any.

EXAMPLE
choose folder with prompt "Choose a folder or volume:"
NOTES
If the user clicks Cancel in the Choose Folder dialog box, AppleScript returns error number -128. If you want your script to continue after the user clicks Cancel, you must include an error handler. For information about Try statements and error handlers, see Chapter 7, "Control Statements," in the AppleScript Language Guide.

ERRORS
Error
number
Error message
-108Out of memory.
-128User canceled.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996